/*
    This is a set of libraries to assist in OpenGl and Other Applications
    Copyright (C) 2008  The Modular Engine Team

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INTERFACECONTAINER_H
#define INTERFACECONTAINER_H


//#include "TinyXMLInterface.h"
#include "ImageLoader.h"
#include "libxml/xmlmemory.h"
#include "libxml/parser.h"
#include "InterfaceObject.h"

#pragma comment(lib, "libxml2.lib")

namespace ModularEngine
{
	class InterfaceSchemaInfo
	{
	public:
		char *mpName;
		char *mpTexture;
		int mWidth;
		int mHeight;

	};

	class CLASSDECL InterfaceContainer: public InterfaceObject
	{
	private:
		/// Interface Module Textures for Window
		enum IMT_WINDOW
		{
			IMT_TOPLEFT = 0,
			IMT_TOPRIGHT,
			IMT_BOTTOMLEFT,
			IMT_BOTTOMRIGHT,
			IMT_LEFTBORDER,
			IMT_RIGHTBORDER,
			IMT_TOPBORDER,
			IMT_BOTTOMBORDER,
			IMT_CLOSE,
			IMT_MINIMIZE,
			IMT_RESTORE,
			IMT_ICON,
			IMT_BACKGROUND
		};
		
		enum IMT_TEXTBOX
		{
			//IMT_
		};

	public:
		/// Init Interface Container
		InterfaceContainer();

		InterfaceSchemaInfo mSchemaInfo;

		xmlDocPtr doc;
		xmlNodePtr cur;

		/// xmlChar * to int
		int xmlToInt( xmlChar *rXML );

		/// xmlChar * to float
		float xmlToFloat( xmlChar *rXML );

		/// xmlChar * to char *
		char *xmlToChar( xmlChar *rXML );


		void ParseElement( xmlNodePtr rElement );



		/// Load Schema from XML Document
		void LoadSchema( const char *rpXMLSchema );

		TextureID mLayoutTexture;
		vector<Vector2d> mTexStartCoords;
		vector<Vector2d> mTexEndCoords;

		/// Draw all subobjects
		void Draw();
	};

}

#endif // #ifndef INTERFACECONTAINER_H